package com.zelin.gulimall.search.controller;

import com.zelin.gulimall.search.service.GulimallSearchService;
import com.zelin.gulimall.search.vo.SearchParam;
import com.zelin.gulimall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * Created by WF on 2021/1/17 13:01
 */
@Controller
public class SearchController {
    @Autowired
    private GulimallSearchService gulimallSearchServicer;
    /**
     * 1.根据查询关键字进行查询
     * @param param
     * @return
     */
    @GetMapping("/list.html")
    public String list(SearchParam param, Model model){
        SearchResult searchResult = gulimallSearchServicer.search(param);
        model.addAttribute("searchResult",searchResult);
        return "list";
    }
}
